<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
</html>
<script>
    // 判断两个值是否相同
    


    // 合并
    var obj1={
        name:"acd",
        age:20
    }
    var obj2={
        height:"178cm",
        age:25
    }
    var obj3={
        hobby:"篮球"
    }
    var res = Object.assign(obj1,obj2,obj3);
    console.log(res);


    // object.hasOwn  判断某个属性是否是对象自身的属性
      Object.prototype.heigth = "178cm"
        var obj = {
            myname: "张三",
            age: 20
        }

        for (let key in obj) {
            // if (obj.hasOwnProperty(key)) { // es5的判断
            if (Object.hasOwn(obj, key)) {
                console.log(key);
            }

            // }
        }

    // object.seal 把对象变成不可配置对象
    var obj5 = {
        name:"acd",
        age:20
    }
    Object.seal(obj5);
    // 不能删  但能改




    // 获取对象的键名
    var obj6 ={
        myname:"sbd",
        age:20
    }
    var arr = Object.keys(obj);
    console.log(arr);


    // 把对象转成querystring的字符串
    var obj7 ={
        myname:"sbd",
        age:20,
        height:"178cm"
    }
    // 获取地址栏?后面的内容
    console.log(window.location.search);
    // qureystring是有规则的字符串
    // 获取地址栏#后面的的内容
    console.log(window.location.hash);

</script>